//
//  MessageCollectionViewController.m
//  Arts1
//
//  Created by apple on 15/8/28.
//  Copyright (c) 2015年 Arts1. All rights reserved.
//

#import "MessageCollectionViewController.h"
#import "MessageCollectionViewCell.h"
#import "MessageTalkViewController.h"
#import "PrefixHeader.pch"

const NSTimeInterval MDViewOneAnimationDuration = 0.5;

@interface MessageCollectionViewController ()<UICollectionViewDelegateFlowLayout>

@end

@implementation MessageCollectionViewController

static NSString * const reuseIdentifier = @"Cell";

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.collectionView.backgroundColor = kBackgroundColor;

    //注册类
    [self.collectionView registerClass:[MessageCollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier];
}

#pragma mark <UICollectionViewDataSource>

//设置多少个分区
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

//设置每个分区多少行
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 10;
}

//重绘cell
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    MessageCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
    return cell;
}
//设置上下左右的距离
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
    return UIEdgeInsetsMake(0, 5, 5, 5);
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    //回调push进入聊天页面方法
    _pushBlock();
    
}
#pragma mark <UICollectionViewDelegate>


@end
